package org.example;

import java.io.*;
import java.nio.ByteBuffer;
import java.nio.channels.FileChannel;
import java.util.Arrays;
import java.util.List;

/**
 * @author 47868
 */
public class Main {
    public static void main(String[] args) throws IOException {
        FileChannel channel = new RandomAccessFile("D:/代码/javaSE/javaSE/source.txt","r").getChannel();
        ByteBuffer buffer = ByteBuffer.allocate(2);
        while (channel.read(buffer) != -1) {
            buffer.flip();
            while (buffer.hasRemaining()) {
                System.out.print((char) buffer.get());
            }
            buffer.clear();
        }
    }
}